﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;

using System.Windows.Forms;

namespace LinkUp
{
    /// <summary>
    /// 游戏网格类
    /// </summary>
    public class Grid
    {
        /// <summary>
        /// 默认构造函数
        /// </summary>
        public Grid()
        {
            //默认值
        }
        #region user functions
        /// <summary>
        /// 创建游戏网格
        /// </summary>
        public void Create(GameLevel level)
        {
            //设置屏幕位置
            SetScreen(level);
            //创建游戏屏幕
            map = new Bitmap(gWidth, gHeight);
            //初始化状态数组
            RandomStat();
            //初始化网格块列表
            InitBlocks();
            //初始化路径查找类
            InitPath();
            //绘制背景图片
            InitBack();
            //绘制游戏界面
            DrawGrid();
        }

        /// <summary>
        /// 设置屏幕位置
        /// </summary>
        public void SetScreen(GameLevel level)
        {
            backOffset = new Point(0, 24);
            gridStartPos = new Point((8 - (int)level / 2) * 25 + backOffset.X, (8 - (int)level / 2) * 25 + backOffset.Y);

            if (isFullScreen)
            {
                int bWidth = SystemInformation.PrimaryMonitorSize.Width - 120 - 2 * gridStartPos.X;
                int bHeight = SystemInformation.PrimaryMonitorSize.Height - 44 - 2 * gridStartPos.Y + backOffset.Y;
                if ((double)bWidth / bHeight >= 1.25)
                {
                    gWidth = (int)(1.25 * bHeight + 0.5);
                    gHeight = bHeight;
                    gridStartPos = new Point((8 - (int)level / 2) * 25 + backOffset.X + (bWidth - gWidth) / 2, (8 - (int)level / 2) * 25 + backOffset.Y);
                }
                else
                {
                    gWidth = bWidth;
                    gHeight = (int)(0.8 * bWidth + 0.5);
                    gridStartPos = new Point((8 - (int)level / 2) * 25 + backOffset.X, (8 - (int)level / 2) * 25 + backOffset.Y + (bHeight - gHeight) / 2);
                }
            }
            else
            {
                gWidth = (int)level * 25 + 400;
                gHeight = (int)level * 20 + 320;
                gridStartPos = new Point((8 - (int)level / 2) * 25 + backOffset.X, (8 - (int)level / 2) * 25 + backOffset.Y);
            }

            hCount = vCount = (int)level;
            blockNum = 2 * hCount;
        }

        /// <summary>
        /// 重绘界面
        /// </summary>
        public void RefreshScreen()
        {
            Graphics g = Graphics.FromImage(map);
            g.DrawImage(backGround, 0, 0, new RectangleF(gridStartPos.X - backOffset.X, gridStartPos.Y - backOffset.Y, map.Width, map.Height), GraphicsUnit.Pixel);
            Pen p = new Pen(Color.Green, 1);
            //绘制网格
            for (int i = 0; i <= hCount; i++)
            {
                g.DrawLine(p, new PointF(hInc, (i + 1) * vInc), new PointF(hInc * (hCount + 1), (i + 1) * vInc));
            }
            for (int j = 0; j <= vCount; j++)
            {
                g.DrawLine(p, new PointF((j + 1) * hInc, vInc), new PointF((j + 1) * hInc, vInc * (vCount + 1)));
            }
            //绘制图片
            for (int i = 0; i < vCount; i++)
            {
                for (int j = 0; j < hCount; j++)
                {
                    if (stat[i * hCount + j] != 0)
                    {
                        g.DrawImage(blocks[stat[i * hCount + j] - 1].Image, (j + 1) * hInc + 1, (i + 1) * vInc + 1, blocks[stat[i * hCount + j] - 1].BWidth, blocks[stat[i * hCount + j] - 1].BHeight);
                    }
                    else
                    {
                        float startX = gPoint.X + (j + 1) * hInc - 1;
                        float startY = gPoint.Y + (i + 1) * vInc - 1;
                        g.DrawImage(backGround, startX, startY, new RectangleF(gridStartPos.X + startX - backOffset.X, gridStartPos.Y + startY - backOffset.Y, blocks[0].BWidth + 4, blocks[0].BHeight + 4), GraphicsUnit.Pixel);
                    }
                }
            }
            p.Dispose();
            g.Dispose();
        }

        /// <summary>
        /// 绘制游戏界面
        /// </summary>
        /// <param name="g"></param>
        private void DrawGrid()
        {
            Graphics g = Graphics.FromImage(map);
            Pen p = new Pen(Color.Green, 1);
            //绘制网格
            for (int i = 0; i <= hCount; i++)
            {
                g.DrawLine(p, new PointF(hInc, (i + 1) * vInc), new PointF(hInc * (hCount + 1), (i + 1) * vInc));
            }
            for (int j = 0; j <= vCount; j++)
            {
                g.DrawLine(p, new PointF((j + 1) * hInc, vInc), new PointF((j + 1) * hInc, vInc * (vCount + 1)));
            }
            //绘制图片
            for (int i = 0; i < vCount; i++)
            {
                for (int j = 0; j < hCount; j++)
                {
                    g.DrawImage(blocks[stat[i * hCount + j] - 1].Image, new PointF((j + 1) * hInc + 1, (i + 1) * vInc + 1));
                }
            }
            p.Dispose();
            g.Dispose();
        }
        /// <summary>
        /// 重新排列
        /// </summary>
        public void RefreshBlock()
        {
            Graphics g = Graphics.FromImage(map);
            //随机重排
            RandomRefresh();
            for (int i = 0; i < vCount; i++)
            {
                for (int j = 0; j < hCount; j++)
                {
                    if (stat[i * hCount + j] > 0)
                    {
                        g.DrawImage(blocks[stat[i * hCount + j] - 1].Image, new PointF((j + 1) * hInc + 1, (i + 1) * vInc + 1));
                    }
                }
            }
            g.Dispose();
        }
        /// <summary>
        /// 获取剩余总数目
        /// </summary>
        /// <returns></returns>
        public int GetCount()
        {
            int count = 0;
            int total = hCount * vCount;
            for (int i = 0; i < total; i++)
            {
                if (stat[i] > 0)
                {
                    count++;
                }
            }
            return count;
        }

        /// <summary>
        /// 随机安排数组元素位置
        /// </summary>
        private void RandomStat()
        {
            //初始化状态数组
            InitStat();
            int j, temp, total = hCount * vCount;
            Random ran = new Random((int)DateTime.Now.Ticks);
            for (int i = total; i > 0; i--)
            {
                j = ran.Next(i);
                temp = stat[i - 1];
                stat[i - 1] = stat[j];
                stat[j] = temp;
            }
        }
        /// <summary>
        /// 刷新重排
        /// </summary>
        private void RandomRefresh()
        {
            int index = 0;
            int total = hCount * vCount;
            int count = GetCount();
            int[] array = new int[count];
            for (int i = 0; i < total; i++)
            {
                if (stat[i] > 0)
                {
                    array[index++] = stat[i];
                }
            }
            int j, temp;
            Random ran = new Random((int)DateTime.Now.Ticks);
            for (int i = count; i > 0; i--)
            {
                j = ran.Next(i);
                temp = array[i - 1];
                array[i - 1] = array[j];
                array[j] = temp;
            }
            index = 0;
            for (int i = 0; index < count; i++)
            {
                if (stat[i] > 0)
                {
                    stat[i] = array[index];
                    Finder.MapData[i % hCount + 1, i / hCount + 1] = array[index++];
                }
            }
        }
        /// <summary>
        /// 初始化网格块链表
        /// </summary>
        private void InitBlocks()
        {
            try
            {
                string imageDir = string.Empty;
                if (skin == GameSkin.Classic)
                {
                    imageDir = "Images\\Classic\\";
                }
                else if (skin == GameSkin.Pet)
                {
                    imageDir = "Images\\Pets\\";
                }
                else if (skin == GameSkin.P3D)
                {
                    imageDir = "Images\\3D\\";
                }
                else if (skin == GameSkin.Genius)
                {
                    imageDir = "Images\\Genius\\";
                }
                else if (skin == GameSkin.Fruits)
                {
                    imageDir = "Images\\Fruits\\";
                }
                else
                {
                    imageDir = "Images\\Mahjong\\";
                }
                StreamReader sr = new StreamReader(imageDir + "pictureinfo", Encoding.Default);
                Block item;
                blocks = new List<Block>();
                bigImage = new List<Bitmap>();
                for (int i = 0; i < blockNum; i++)
                {
                    item = new Block(i + 1);
                    item.BWidth = (int)(hInc + 0.5) - 1;
                    item.BHeight = (int)(vInc + 0.5) - 1;
                    item.BMsg = (sr.ReadLine().Split('\t'))[1];
                    item.Image = new Bitmap(imageDir + (i + 1).ToString() + ".bmp");
                    bigImage.Add(new Bitmap(item.Image, 120, 96));
                    item.Create();
                    blocks.Add(item);
                }
                sr.Dispose();
            }
            catch
            {
                throw new Exception("无法加载图片，游戏初始化失败！");
            }
        }
        /// <summary>
        /// 初始化游戏网格
        /// </summary>
        private void InitStat()
        {
            int index = 0;
            stat = new int[hCount * vCount];
            for (int i = 0; i < stat.Length; i++)
            {
                stat[i] = index++ % blockNum + 1;
            }
            if ((stat.Length / blockNum) % 2 != 0)
            {
                int start = stat.Length - blockNum;
                for (int i = 0; i < blockNum / 2; i++)
                {
                    stat[stat.Length - i - 1] = stat[start + i];
                }
            }
        }
        /// <summary>
        /// 初始化路径查找
        /// </summary>
        private void InitPath()
        {
            int[,] mapState = new int[hCount + 2, vCount + 2];
            for (int i = 0; i < vCount + 2; i++)
            {
                for (int j = 0; j < hCount + 2; j++)
                {
                    if (i == 0 || i == vCount + 1 || j == 0 || j == hCount + 1)
                    {
                        mapState[i, j] = 0;
                    }
                    else
                    {
                        mapState[i, j] = stat[(i - 1) * hCount + j - 1];
                    }
                }
            }
            finder = new Path(mapState);
        }
        /// <summary>
        /// 绘制背景图片
        /// </summary>
        public void InitBack()
        {
            try
            {
                string bgDir = "images\\BackGround\\";
                Random ran = new Random((int)DateTime.Now.Ticks);
                if (backGround == null)
                {
                    if (!isFullScreen)
                    {
                        backGround = new Bitmap(Image.FromFile(bgDir + ran.Next(1, 16).ToString() + ".jpg"), 800, 640);
                    }
                    else
                    {
                        backGround = new Bitmap(Image.FromFile(bgDir + ran.Next(1, 16).ToString() + ".jpg"), SystemInformation.PrimaryMonitorSize.Width - 120, SystemInformation.PrimaryMonitorSize.Height - 44);
                    }
                }
            }
            catch
            {
                throw new Exception("无法加载背景图片，游戏初始化失败！");
            }
        }
        /// <summary>
        /// 绘制路径上的点
        /// </summary>
        /// <param name="g"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void DrawDot(Graphics g, int x, int y)
        {
            g.DrawEllipse(new Pen(Color.Gold, 3), x * hInc + hInc / 4 + 2, y * vInc + vInc / 4 + 2, hInc / 2 - 3, vInc / 2 - 3);
            g.DrawString("H", new Font("宋体", 26, FontStyle.Bold), new SolidBrush(Color.Gold), new RectangleF(x * hInc + hInc / 4 + 1, y * vInc + vInc / 4 - 4, hInc / 2, vInc / 2));
        }
        /// <summary>
        /// 消除相同的游戏块
        /// </summary>
        /// <param name="i"></param>
        /// <param name="j"></param>
        public void Erase(int i, int j)
        {
            Graphics g = Graphics.FromImage(map);
            //消除第一块
            g.DrawImage(backGround, GetPoint(i).X - 2, GetPoint(i).Y - 2, new RectangleF(gridStartPos.X + GetPoint(i).X - 2 - backOffset.X, gridStartPos.Y + GetPoint(i).Y - 2 - backOffset.Y, blocks[stat[i - 1] - 1].BWidth + 4, blocks[stat[i - 1] - 1].BHeight + 4), GraphicsUnit.Pixel);
            stat[i - 1] = 0;
            finder.MapData[finder.StartPosition.X, finder.StartPosition.Y] = 0;

            //消除第二块
            g.DrawImage(backGround, GetPoint(j).X - 2, GetPoint(j).Y - 2, new RectangleF(gridStartPos.X + GetPoint(j).X - 2 - backOffset.X, gridStartPos.Y + GetPoint(j).Y - 2 - backOffset.Y, blocks[stat[j - 1] - 1].BWidth + 4, blocks[stat[j - 1] - 1].BHeight + 4), GraphicsUnit.Pixel);
            stat[j - 1] = 0;
            finder.MapData[finder.EndPosition.X, finder.EndPosition.Y] = 0;

            g.Dispose();
        }

        /// <summary>
        /// 显示提示块
        /// </summary>
        /// <param name="i"></param>
        /// <param name="j"></param>
        public void Prompt(IList<Point> pList)
        {
            Graphics g = Graphics.FromImage(map);
            Color[] promptColors = { Color.Yellow, Color.Red, Color.DeepPink };
            Random ran = new Random(DateTime.Now.Millisecond);
            int colorIndex = ran.Next(0, promptColors.Length);
            foreach (Point p in pList)
            {
                g.DrawEllipse(new Pen(promptColors[colorIndex], 3), p.X * hInc + hInc / 4 + 2, p.Y * vInc + vInc / 4 + 2, hInc / 2 - 3, vInc / 2 - 3);
                g.DrawString("*", new Font("宋体", 26, FontStyle.Bold), new SolidBrush(promptColors[colorIndex]), new RectangleF(p.X * hInc + hInc / 4 + 1, p.Y * vInc + vInc / 4 - 4, hInc / 2, vInc / 2));
            }
            g.Dispose();
        }

        /// <summary>
        /// 取消显示提示块
        /// </summary>
        /// <param name="i"></param>
        /// <param name="j"></param>
        public void UnPrompt(IList<Point> pList)
        {
            Graphics g = Graphics.FromImage(map);
            g.DrawImage(blocks[stat[(pList[0].Y - 1) * hCount + pList[0].X - 1] - 1].Image, pList[0].X * hInc + hInc / 4, pList[0].Y * vInc + vInc / 4, new RectangleF(hInc / 4 - 1, vInc / 4 - 1, hInc / 2 + 1, vInc / 2 + 1), GraphicsUnit.Pixel);
            g.DrawImage(blocks[stat[(pList[1].Y - 1) * hCount + pList[1].X - 1] - 1].Image, pList[1].X * hInc + hInc / 4, pList[1].Y * vInc + vInc / 4, new RectangleF(hInc / 4 - 1, vInc / 4 - 1, hInc / 2 + 1, vInc / 2 + 1), GraphicsUnit.Pixel);
            for (int i = 2; i < pList.Count; i++)
            {
                g.DrawImage(backGround, pList[i].X * hInc + hInc / 4 - 1, pList[i].Y * vInc + vInc / 4 - 1, new RectangleF(gridStartPos.X + pList[i].X * hInc + hInc / 4 - backOffset.X - 1, gridStartPos.Y + pList[i].Y * vInc + vInc / 4 - backOffset.Y - 1, hInc / 2 + 2, vInc / 2 + 2), GraphicsUnit.Pixel);
            }
            g.Dispose();
        }
        /// <summary>
        /// 选中游戏块
        /// </summary>
        /// <param name="index"></param>
        public void Choose(int index)
        {
            Graphics g = Graphics.FromImage(map);
            g.DrawRectangle(new Pen(Color.Blue, 4), GetPoint(index).X + 2, GetPoint(index).Y + 2, blocks[stat[index - 1] - 1].BWidth - 2, blocks[stat[index - 1] - 1].BHeight - 2);
            g.Dispose();
        }
        /// <summary>
        /// 取消选中游戏块
        /// </summary>
        /// <param name="index"></param>
        public void UnChoose(int index)
        {
            Graphics g = Graphics.FromImage(map);
            Pen p = new Pen(Color.Green, 1);
            g.DrawImage(blocks[stat[index - 1] - 1].Image, GetPoint(index).X + 1, GetPoint(index).Y + 1, blocks[stat[index - 1] - 1].BWidth, blocks[stat[index - 1] - 1].BHeight);
            g.DrawRectangle(p, GetPoint(index).X, GetPoint(index).Y, blocks[stat[index - 1] - 1].BWidth + 1, blocks[stat[index - 1] - 1].BHeight + 1);
            p.Dispose();
            g.Dispose();
        }

        /// <summary>
        /// 交换两个游戏块
        /// </summary>
        /// <param name="preBlock"></param>
        /// <param name="curBlock"></param>
        public void ExChange(int preBlock, int curBlock)
        {
            if (stat[preBlock - 1] == 0 && stat[curBlock - 1] == 0)
                return;
            Graphics g = Graphics.FromImage(map);
            Pen p = new Pen(Color.Green, 1);
            int tempValue = stat[curBlock - 1];
            if (stat[preBlock - 1] == 0)
            {
                //前一位置为空，则在后一位置绘制背景
                g.DrawImage(backGround, GetPoint(curBlock).X - 1, GetPoint(curBlock).Y - 1, new RectangleF(gridStartPos.X + GetPoint(curBlock).X - 1 - backOffset.X, gridStartPos.Y + GetPoint(curBlock).Y - 1 - backOffset.Y, blocks[stat[curBlock - 1] - 1].BWidth + 4, blocks[stat[curBlock - 1] - 1].BHeight + 4), GraphicsUnit.Pixel);
                stat[curBlock - 1] = 0;
                finder.MapData[finder.GetPointByIndex(curBlock).X, finder.GetPointByIndex(curBlock).Y] = 0;
            }
            else
            {
                //在后一位置绘制前一位置的图片
                g.DrawImage(blocks[stat[preBlock - 1] - 1].Image, GetPoint(curBlock).X + 1, GetPoint(curBlock).Y + 1, blocks[stat[preBlock - 1] - 1].BWidth, blocks[stat[preBlock - 1] - 1].BHeight);
                g.DrawRectangle(p, GetPoint(preBlock).X, GetPoint(preBlock).Y, blocks[stat[preBlock - 1] - 1].BWidth + 1, blocks[stat[preBlock - 1] - 1].BHeight + 1);
                stat[curBlock - 1] = GetBlock(preBlock).BValue;
                finder.MapData[finder.GetPointByIndex(curBlock).X, finder.GetPointByIndex(curBlock).Y] = preBlock;
            }
            //在前一位置绘制后一位置的图片
            g.DrawImage(blocks[tempValue - 1].Image, GetPoint(preBlock).X + 1, GetPoint(preBlock).Y + 1, blocks[tempValue - 1].BWidth, blocks[tempValue - 1].BHeight);
            g.DrawRectangle(p, GetPoint(preBlock).X, GetPoint(preBlock).Y, blocks[tempValue - 1].BWidth + 1, blocks[tempValue - 1].BHeight + 1);
            stat[preBlock - 1] = tempValue;
            finder.MapData[finder.GetPointByIndex(preBlock).X, finder.GetPointByIndex(preBlock).Y] = tempValue;

            p.Dispose();
            g.Dispose();
        }

        /// <summary>
        /// 判断是否为有效的点击
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public bool IsValidClick(float x, float y)
        {
            return !(x < gPoint.X + hInc || x >= gPoint.X + gWidth - hInc || y < gPoint.Y + vInc || y >= gPoint.Y + gHeight - vInc);
        }
        /// <summary>
        /// 通过坐标获取点击的游戏块索引号,点(x,y)必须在网格坐标内。
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public int GetIndex(float x, float y)
        {
            return (int)((y - gPoint.Y) / vInc - 1) * hCount + (int)((x - gPoint.X) / hInc);
        }
        /// <summary>
        /// 根据索引号获取游戏块的左上角位置
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public PointF GetPoint(int index)
        {
            return new PointF(gPoint.X + hInc + (index - 1) % hCount * hInc, gPoint.Y + vInc + (index - 1) / vCount * vInc);
        }
        /// <summary>
        /// 根据坐标定位索引
        /// </summary>
        /// <param name="pos"></param>
        /// <returns></returns>
        public int GetIndex(Point pos)
        {
            return (pos.Y - 1) * hCount + (pos.X - 1) + 1;
        }
        /// <summary>
        /// 通过索引号获取游戏块
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Block GetBlock(int index)
        {
            return blocks[stat[index - 1] - 1];
        }
        /// <summary>
        /// 通过索引号获取游戏块的放大图
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public Bitmap GetBigImage(int index)
        {
            return bigImage[stat[index - 1] - 1];
        }
        #endregion

        #region fields and properties
        private Bitmap map;
        /// <summary>
        /// 游戏网格图
        /// </summary>
        public Bitmap Map
        {
            get { return map; }
            set { map = value; }
        }
        private Bitmap backImage;
        /// <summary>
        /// 背景图片
        /// </summary>
        public Bitmap BackImage
        {
            get { return backImage; }
            set { backImage = value; }
        }
        private int gWidth;
        /// <summary>
        /// 网格块的宽度
        /// </summary>
        public int GWidth
        {
            get { return gWidth; }
            set { gWidth = value; }
        }
        private int gHeight;
        /// <summary>
        /// 网格块的高度
        /// </summary>
        public int GHeight
        {
            get { return gHeight; }
            set { gHeight = value; }
        }
        private int hCount;
        /// <summary>
        /// 水平网格数
        /// </summary>
        public int HCount
        {
            get { return hCount; }
            set { hCount = value; }
        }
        private int vCount;
        /// <summary>
        /// 垂直网格数
        /// </summary>
        public int VCount
        {
            get { return vCount; }
            set { vCount = value; }
        }
        private PointF gPoint;
        /// <summary>
        /// 游戏网格左上角位置
        /// </summary>
        public PointF GPoint
        {
            get { return gPoint; }
            set { gPoint = value; }
        }
        private int[] stat;
        /// <summary>
        /// 网格当前状态信息
        /// </summary>
        public int[] Stat
        {
            get { return stat; }
            set { stat = value; }
        }
        private int blockNum;
        /// <summary>
        /// 不同游戏块的数目
        /// </summary>
        public int BlockNum
        {
            get { return blockNum; }
            set { blockNum = value; }
        }
        private List<Block> blocks;
        /// <summary>
        /// 游戏块的集合
        /// </summary>
        public List<Block> Blocks
        {
            get { return blocks; }
            set { blocks = value; }
        }
        private List<Bitmap> bigImage;
        /// <summary>
        /// 游戏块的放大图
        /// </summary>
        public List<Bitmap> BigImage
        {
            get { return bigImage; }
            set { bigImage = value; }
        }
        /// <summary>
        /// 网格块的宽度
        /// </summary>
        private float hInc
        {
            get { return (float)gWidth / (hCount + 2); }
        }
        /// <summary>
        /// 网格块的高度
        /// </summary>
        private float vInc
        {
            get { return (float)gHeight / (vCount + 2); }
        }
        private Path finder;
        /// <summary>
        /// 由于判断游戏块能否相消
        /// </summary>
        public Path Finder
        {
            get { return finder; }
            set { finder = value; }
        }
        private Bitmap backGround;
        /// <summary>
        /// 游戏背景图片
        /// </summary>
        public Bitmap BackGround
        {
            get { return backGround; }
            set { backGround = value; }
        }
        private Point gridStartPos;
        /// <summary>
        /// 网格左上角坐标
        /// </summary>
        public Point GridStartPos
        {
            get { return gridStartPos; }
            set { gridStartPos = value; }
        }
        private Image promptImage;
        /// <summary>
        /// 提示图片
        /// </summary>
        public Image PromptImage
        {
            get { return promptImage; }
            set { promptImage = value; }
        }
        private Point backOffset;
        /// <summary>
        /// 背景图片的偏移
        /// </summary>
        public Point BackOffset
        {
            get { return backOffset; }
            set { backOffset = value; }
        }
        private GameSkin skin = GameSkin.Classic;
        /// <summary>
        /// 游戏皮肤
        /// </summary>
        public GameSkin Skin
        {
            get { return skin; }
            set { skin = value; }
        }
        private bool isFullScreen;
        /// <summary>
        /// 是否全屏
        /// </summary>
        public bool IsFullScrenn
        {
            get { return isFullScreen; }
            set { isFullScreen = value; }
        }

        //private Bitmap originBack;
        ///// <summary>
        ///// 原始背景图
        ///// </summary>
        //public Bitmap OriginBack
        //{
        //    get { return originBack; }
        //    set { value = originBack; }
        //}
        #endregion
    }
}
